import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class CommondataService {

  /*
      路由转换将数据存储在服务，数据展示组件从这里获取数据
  */
 idealData: any = [];
 suitableData: any = [];
 theBestData: any = [];
 user: any = {};

  constructor() { }

  // 路由转换时为数据展示组件定义数据
  setData(data: any, user: any) {
    this.user = user;
    this.idealData = data['IdealArea'];
    data['suitableArea'].map((data: any) => {
      data.map((data: any) => {
        this.suitableData.push(data);
      })
    })
    this.theBestData = data['theBestWay']
  }
}
